package cn.zw.design.observer.jdk;

import java.util.Observable;
import java.util.Observer;

import javax.swing.JButton;

import cn.zw.design.observer.DisplayElements;


public class Observer1 implements Observer,DisplayElements {

	private  float temp;
	private float pressure;
	private float humidity;
	  
	
	private Observable observable; // 构建观察者的时候，为该观察者注册对应的主题
	
	public Observer1(Observable weatherData) {
		this.observable = weatherData;
		observable.addObserver(this);
		System.out.println("23232323");
	}
	
	
	@Override
	public void update(Observable o, Object subject) {
		if(o instanceof  WeatherData){
			WeatherData wd = (WeatherData)o;
			System.out.println(wd.getHumidity());
		}
		
	}

	@Override
	public void display() {
		// TODO Auto-generated method stub
		
	}
	
}
